]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
js/main: Inhibit remote access when depending on session mode
authorJonas Ådahl <jadahl@gmail.com>
Tue, 21 Apr 2020 14:13:20 +0000 (16:13 +0200)
committerJonas Ådahl <jadahl@gmail.com>
Mon, 27 Apr 2020 15:18:18 +0000 (15:18 +0000)
The session mode determines whether the screen casting should work or
not, but until now only dealt with the built in screen cast, not the
ones using PipeWire. Add the newly added API for inhibiting remote
access when the session mode says screencasts are not allowed.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1210

js/ui/main.js

index bdd93ae1b0080c55ad5e9e0b71fb1e7e6008c7e7..2d7a4801917945a35768629b2a7479d189d0330c 100644 (file)
@@ -97,6 +97,8 @@ let _oskResource = null;
 Gio._promisify(Gio._LocalFilePrototype, 'delete_async', 'delete_finish');
 Gio._promisify(Gio._LocalFilePrototype, 'touch_async', 'touch_finish');
 
+let _remoteAccessInhibited = false;
+
 function _sessionUpdated() {
     if (sessionMode.isPrimary)
         _loadDefaultStylesheet();
@@ -121,6 +123,17 @@ function _sessionUpdated() {
         if (lookingGlass)
             lookingGlass.close();
     }
+
+    let remoteAccessController = global.backend.get_remote_access_controller();
+    if (remoteAccessController) {
+        if (sessionMode.allowScreencast && _remoteAccessInhibited) {
+            remoteAccessController.uninhibit_remote_access();
+            _remoteAccessInhibited = false;
+        } else if (!sessionMode.allowScreencast && !_remoteAccessInhibited) {
+            remoteAccessController.inhibit_remote_access();
+            _remoteAccessInhibited = true;
+        }
+    }
 }
 
 function start() {